// inject injected script
var s = document.createElement("script");
s.src = chrome.runtime.getURL("injected.js");
s.onload = function () {
  this.remove();
};
(document.head || document.documentElement).appendChild(s);

// receive message from injected script
window.addEventListener("message", function (e) {
  if (e.data.data) {
    chrome.runtime.sendMessage({
      action: "doTask",
      data: e.data.data,
    });
  }
});
